package com.ossjk.oa.attendance.mapper;

import com.ossjk.oa.attendance.entity.Attendance;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;

/**
 * <p>
 * 考勤 Mapper 接口
 * </p>
 *
 * @author chair
 * @since 2019-02-03
 */
public interface AttendanceMapper extends BaseMapper<Attendance> {

	List selectVoPage(Page page, @Param("ew") Wrapper wrapper);

	List selectCalendar(@Param("ew") Wrapper wrapper);

	List selectDetail(@Param("ew") Wrapper wrapper);
	
    @Select("select DISTINCT (year*100+month) from attendance where (year*100+month)<(select min(year*100+month) from attendance where(year*100+month) = #{mth}) order by   (year*100+month) desc")
    Integer selectPreMth(Integer mth);
    
    @Select("select   DISTINCT (year*100+month) from attendance where (year*100+month)>(select max(year*100+month) from attendance where (year*100+month)= #{mth}) order by (year*100+month)")
    Integer selectNextMth(Integer mth);
    
}
